package com.et114.core.control;

import java.util.HashMap;

//import org.apache.commons.logging.Log;
//import org.apache.commons.logging.LogFactory;

import com.et114.core.common.CONST;

/**
 * @author V1
 */
public class TokenMapImpl implements ITokenMap {
//	private Log logger = LogFactory.getLog( this.getClass() );
	public static HashMap	saveToken	= new HashMap ( );
	public static HashMap	checkToken	= new HashMap ( );
	public void appendMap ( String method , byte type ) {
		if ( CONST.SAVE_TOKEN == type ) {
			saveToken.put ( method , method );
		}
		else {
			checkToken.put ( method , method );
		}
	}
	
	public boolean isExist ( String method , byte type ) {
		if ( method == null || "".equals ( method.trim ( ) ) )
			return false;
		String value = null;
		if ( CONST.SAVE_TOKEN == type ) {
			value = ( String ) saveToken.get ( method );
		} else {
			value = ( String ) checkToken.get ( method );
		}
		if ( method.equals ( value ) )
			return true;
		else
			return false;
	}
}
